package com.woniuxy.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.dao.RbacManagerDao1;

import com.woniuxy.entity.RbacManager;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: wgt
 * Date: 2021/11/28:17:21
 * Description:
 */
@RestController
@RequestMapping("/manager")
public class RbacManagerController {
    @Autowired
    RbacManagerService rbacManagerService;
@RequestMapping("/findAll")
    public PageInfo findAll( @PathVariable int pageNum , @PathVariable int pageSize){
    PageHelper.startPage(pageNum,pageSize);
    List<RbacManager> all = rbacManagerService.findAll();
    PageInfo<RbacManager> page=new PageInfo(all);
    System.out.println(page);
    return page;
}
    @RequestMapping("/save")
    public ResponseEntity save(@RequestBody RbacManager rbacManager){

        return  rbacManagerService.save(rbacManager);

    }
    @RequestMapping("/delete")
    public ResponseEntity delete( int id){

        return  rbacManagerService.deleteById(id);

    }
    @RequestMapping("/update")
    public ResponseEntity update(@RequestBody RbacManager rbacManager){

        return  rbacManagerService.update(rbacManager);

    }

}
